package com.acme.domain.account;

import com.acme.exceptions.NoEnoughFundsException;

import java.io.Serializable;

public abstract class AbstractAccount implements Account, Serializable {
    private static final long serialVersionUID = 1L;

    protected double balance;

    public AbstractAccount(final double amount) {
        this.balance = amount;
    }

    public double getBalance() {
        return balance;
    }

    public long decimalValue() {
        return Math.round(getBalance());
    }

    public abstract void deposit(final double amount)
            throws IllegalArgumentException;

    public abstract void withdraw(final double amount)
            throws NoEnoughFundsException;
}
